package br.com.bikes4bikers.model;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Embeddable;

/**
 * Classe que representa a primary key da classe EnderecoUsuario.
 * @author Arthur
 *
 */
@Embeddable
public class EnderecoUsuarioPK implements Serializable{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 4150290827528213703L;
	/**
	 * Item da chave composta
	 */
	@Column(name="cpf_usuario")
	private String cpf;
	/**
	 * Item da chave composta
	 */
	@Column(name="id_endereco")
	private Integer idEndereco;
	
	
	
	public EnderecoUsuarioPK() {
		super();
	}

	public EnderecoUsuarioPK(String cpf, Integer idEndereco) {
		super();
		this.cpf = cpf;
		this.idEndereco = idEndereco;
	}

	/**
	 * @return the cpf
	 */
	public String getCpf() {
		return cpf;
	}

	/**
	 * @param cpf the cpf to set
	 */
	public void setCpf(String cpf) {
		this.cpf = cpf;
	}

	/**
	 * @return the idEndereco
	 */
	public Integer getIdEndereco() {
		return idEndereco;
	}

	/**
	 * @param idEndereco the idEndereco to set
	 */
	public void setIdEndereco(Integer idEndereco) {
		this.idEndereco = idEndereco;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#hashCode()
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((cpf == null) ? 0 : cpf.hashCode());
		result = prime * result
				+ ((idEndereco == null) ? 0 : idEndereco.hashCode());
		return result;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		EnderecoUsuarioPK other = (EnderecoUsuarioPK) obj;
		if (cpf == null) {
			if (other.cpf != null)
				return false;
		} else if (!cpf.equals(other.cpf))
			return false;
		if (idEndereco == null) {
			if (other.idEndereco != null)
				return false;
		} else if (!idEndereco.equals(other.idEndereco))
			return false;
		return true;
	}

}
